package com.example.design.patterns.geekbang.行为型.迭代器模式;

import java.util.ArrayList;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();
        names.add("xzg");
        names.add("wang");
        names.add("zheng");

        Iterator<String> iterator = new ArrayIterator(names);
        while (iterator.hasNext()) {
            System.out.println(((ArrayIterator<String>) iterator).currentItem());
            iterator.next();
        }
    }
}
